package br.com.salaodebeleza.persistence;

import java.util.List;

import javax.inject.Inject;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;

import org.slf4j.Logger;

import br.com.salaodebeleza.domain.TbMenuBotao;
import br.gov.frameworkdemoiselle.stereotype.PersistenceController;
import br.gov.frameworkdemoiselle.template.JPACrud;

@PersistenceController
public class TbMenuBotaoDAO extends JPACrud<TbMenuBotao, Long> {

	private static final long serialVersionUID = 1L;
	
	@Inject
	@SuppressWarnings("unused")
	private Logger logger;
	
	public List<TbMenuBotao> findByMenuId(long menuid) {
		CriteriaQuery<TbMenuBotao> criteriaQuery = createCriteriaQuery();
		Root<TbMenuBotao> from = criteriaQuery.from(TbMenuBotao.class);
		criteriaQuery.where(getCriteriaBuilder().equal(from.get("menu"), menuid));		
		return super.findByCriteriaQuery(criteriaQuery);
	}
	
}
